<%@page import="com.shsh.safemanage.model.PostcheckMonthQualityReport.ChushiReport"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.model.PostcheckMonthQualityReport"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%
{
	PostcheckMonthQualityReport report = (PostcheckMonthQualityReport)session.getAttribute(Constants.SESSION_POSTCHECK_MONTH_QUALITY_REPORT);
	if (report==null){
		return;
	}
	int year = report.getYear();
	int month = report.getMonth();
	int[] months = Util.getSeasonMonth(month);
	int monthIndex = Util.getMonthIndexInSeason(month);
%>

<div class="content" style="width:1500px;">

	<div class="tt">《处室岗检质量评价表》</div>
	<div style="width:97%;margin-left: 10px;font-weight:bold;font-size:20; ">
	<span style="margin-right: 20px;float:right;">
		月份：<%=report.getYear() %>年<%=report.getMonth() %>月
	</span>
	</div>
<table border="1" width="99%" style="align:center; margin-left: 6px">
	<tr>
		<td rowspan="2" style="text-align:center;width:10%;" class="td3">
		单位
		</td>
		<td rowspan="2" style="text-align:center;width:3%;" class="td3">
		部门管理人员数
		</td>
		<td rowspan="2" style="text-align:center;width:3%;" class="td3">
		参加岗检人数
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		季度计划被检单位总数
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		实际岗检单元总数
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		季度实际岗检人次数
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		查出问题数
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		考核扣分
		</td>
		<td colspan="3" style="text-align:center;" class="td3">
		查出“三违”现象次数
		</td>
		<td colspan="4" style="text-align:center;" class="td3">
		岗检计划完成率
		</td>
		<td colspan="4" style="text-align:center;" class="td3">
		岗检工作参与度
		</td>
		<td colspan="4" style="text-align:center;" class="td3">
		岗检问题覆盖面
		</td>
		<td colspan="4" style="text-align:center;" class="td3">
		查出“三违”现象得分
		</td>
		<td colspan="4" style="text-align:center;" class="td3">
		岗检评价得分
		</td>
	</tr>
	<tr>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:3%;" class="td3">
		平均值
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:3%;" class="td3">
		平均值
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:3%;" class="td3">
		平均值
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:3%;" class="td3">
		平均值
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[0]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[1]%>月
		</td>
		<td style="text-align:center;width:2%;" class="td3">
		<%=months[2]%>月
		</td>
		<td style="text-align:center;width:3%;" class="td3">
		平均值
		</td>
	</tr>
<%
for(Long chushiID: report.getChushiList().keySet()) {
	Department1 chushi = report.getChushiList().get(chushiID);
	ChushiReport chushiReport = report.getChushiReportMap().get(chushiID);
	if(chushiReport == null ) {
		continue;
	}
%>
	<tr>
		<td style="text-align:center;" class="td3">
		<%=Util.getDisplay(chushi.getDepartmentName(), "&nbsp;") %>
		</td>
		<td style="text-align:center;width:30px;" >
			<input type="text" id="employeeCount<%=chushiID %>" name="employeeCount<%=chushiID %>" style="width:25px;" value="<%=Util.getDisplay(chushiReport.getEmployeeCount(), "") %>"/>
		</td>
		<td style="text-align:center;width:30px;" >
			<input type="text" id="chushiWorkerCount<%=chushiID %>" name="chushiWorkerCount<%=chushiID %>" style="width:25px;" value="<%=Util.getDisplay(chushiReport.getWorkerCount(), "") %>"/>
		</td>
<%
for(int i=0;i<3;i++) {
	if (i==monthIndex) {
%>
		<td style="text-align:center;" >
			<input type="text" id="chushiCheckUnitCountNeed<%=chushiID %>" name="chushiCheckUnitCountNeed<%=chushiID %>" style="width:25px;" value="<%=Util.getDisplay(chushiReport.getCheckUnitCountNeed()[i], "") %>"/>
		</td>
<%
	} else {
%>

		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCheckUnitCountNeed()[i], "&nbsp;") %>
		</td>
<%	
	}
}
%>

<%
for(int i=0;i<3;i++) {
	if (i==monthIndex) {
%>
		<td style="text-align:center;" >
			<input type="text" id="chushiCheckUnitCountReal<%=chushiID %>" name="chushiCheckUnitCountReal<%=chushiID %>" style="width:25px;" value="<%=Util.getDisplay(chushiReport.getCheckUnitCountReal()[i], "") %>"/>
		</td>
<%
	} else {
%>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCheckUnitCountReal()[i], "&nbsp;") %>
		</td>
<%
	}
}
%>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getMantimeReal()[0], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getMantimeReal()[1], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getMantimeReal()[2], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getProblemCount()[0], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getProblemCount()[1], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getProblemCount()[2], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getGradeSum()[0]==null?null:Util.formatGrade(chushiReport.getGradeSum()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getGradeSum()[1]==null?null:Util.formatGrade(chushiReport.getGradeSum()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getGradeSum()[2]==null?null:Util.formatGrade(chushiReport.getGradeSum()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getIsSanweiCount()[0], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getIsSanweiCount()[1], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getIsSanweiCount()[2], "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getFinishRate()[0]==null?null:Util.formatRate(chushiReport.getFinishRate()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getFinishRate()[1]==null?null:Util.formatRate(chushiReport.getFinishRate()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getFinishRate()[2]==null?null:Util.formatRate(chushiReport.getFinishRate()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getFinishRate()[3]==null?null:Util.formatRate(chushiReport.getFinishRate()[3]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getPartakeRate()[0]==null?null:Util.formatRate(chushiReport.getPartakeRate()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getPartakeRate()[1]==null?null:Util.formatRate(chushiReport.getPartakeRate()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getPartakeRate()[2]==null?null:Util.formatRate(chushiReport.getPartakeRate()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getPartakeRate()[3]==null?null:Util.formatRate(chushiReport.getPartakeRate()[3]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCoverageRate()[0]==null?null:Util.formatRate(chushiReport.getCoverageRate()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCoverageRate()[1]==null?null:Util.formatRate(chushiReport.getCoverageRate()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCoverageRate()[2]==null?null:Util.formatRate(chushiReport.getCoverageRate()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getCoverageRate()[3]==null?null:Util.formatRate(chushiReport.getCoverageRate()[3]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getSanweiRate()[0]==null?null:Util.formatRate(chushiReport.getSanweiRate()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getSanweiRate()[1]==null?null:Util.formatRate(chushiReport.getSanweiRate()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getSanweiRate()[2]==null?null:Util.formatRate(chushiReport.getSanweiRate()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getSanweiRate()[3]==null?null:Util.formatRate(chushiReport.getSanweiRate()[3]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getAssessRate()[0]==null?null:Util.formatRate(chushiReport.getAssessRate()[0]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getAssessRate()[1]==null?null:Util.formatRate(chushiReport.getAssessRate()[1]), "&nbsp;") %>
		</td>
		<td style="text-align:center;" >
			<%=Util.getDisplay(chushiReport.getAssessRate()[2]==null?null:Util.formatRate(chushiReport.getAssessRate()[2]), "&nbsp;") %>
		</td>
		<td style="text-align:center;font-weight:bold;" >
			<%=Util.getDisplay(chushiReport.getAssessRate()[3]==null?null:Util.formatRate(chushiReport.getAssessRate()[3]), "&nbsp;") %>
		</td>
	</tr>	
<%
}
%>
	<tr>

			<td style="text-align:center;" class="td3">
			汇总统计人
			</td>
			<td colspan="5" style="text-align:center;">
				<%=Util.getDisplay(report.getChushiWriteUserName(),"&nbsp;") %>
			</td>
			<td colspan="3" style="text-align:center;" class="td3">
			日期
			</td>
			<td colspan="6" style="text-align:center;">
				<%=Util.getDisplay(report.getChushiWriteTime()==null?null:Util.formatDate(report.getChushiWriteTime()),"&nbsp;") %>
			</td>
			<td colspan="26" style="text-align:center;">
				&nbsp;
			</td>
	</tr>
</table>
<div style = "padding-top:20px;">
	<input type="button" style="margin-left: 45%;" value="保 存" onclick="writeChushiQualityReport()" />
	<input type="button" style="margin-left: 30px;" value="取 消" onclick="cancelWrite()" />
</div>
</div>

<script type="text/javascript">
function createShiyebuParamJSON(){
	var paramJSON = '';	
	$('input:text').each(function(){
		var paramName = "'" + this.name + "'" ;
		var paramValue =  "'" + $(this).attr('value') + "'";
		paramJSON =  paramJSON + "," + paramName + ":" + paramValue;
	});
	
	paramJSON = paramJSON.substring(1);
	paramJSON = '{' + paramJSON + '}';

	return paramJSON;
}

function writeChushiQualityReport(){
	var paramJSON = createShiyebuParamJSON();

	if ($.dialog.confirm('您确定保存此报告吗？', function(){
		openWaitingDialog('waitingDialog');
		$.ajax({
			type:'post',
			url:'<%=request.getContextPath()%>/postcheck/report/write_month_quality_process.jsp',
			data:{
				paramJSON: paramJSON
			},
			success:function(data,state,xmlhttp){
				var obj = null;
				try {
					obj = eval('(' + data + ')');
				} catch (e) {
				}
				if (typeof(obj.isSuccess) != 'undefined') {
					closeWaitingDialog('waitingDialog');
					if (obj.isSuccess == 'true') {
						$.dialog('报告填报成功！', function() { loadPageSection('<%=request.getContextPath()%>/postcheck/report/write_month_quality.jsp', 'mainContentDiv', {year: <%=year%>, month: <%=month%>}); });
					} else {
						$.dialog.alert(obj.error);
					}
				}
			}
		});
	}, function(){}));
}
function cancelWrite() {
	loadPageSection('<%=request.getContextPath()%>/postcheck/report/write_month_quality_cancel.jsp', 'mainContentDiv');
}
</script>
<%
}
%>